package ansj.solr;

import java.util.Map;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.util.TokenizerFactory;
import org.apache.lucene.util.AttributeFactory;

public class AnsjTokenizerFactory extends TokenizerFactory {

	private int analysisType = 0;
	private boolean rmPunc = true;
	private String conf = null;
	
	
	public AnsjTokenizerFactory(Map<String, String> args) {
		super(args);
		getLuceneMatchVersion();
		analysisType = getInt(args, "analysisType", 0);
		rmPunc = getBoolean(args, "rmPunc", true);
		conf = get(args, "conf");
		System.out.println(":::ansj:construction::::::::::::::::::::::::::" + conf);
	}


	@Override
	public Tokenizer create(AttributeFactory factory) {
		return new AnsjTokenizer(analysisType, rmPunc);
	}


	public int getAnalysisType() {
		return analysisType;
	}


	public void setAnalysisType(int analysisType) {
		this.analysisType = analysisType;
	}


	public boolean isRmPunc() {
		return rmPunc;
	}


	public void setRmPunc(boolean rmPunc) {
		this.rmPunc = rmPunc;
	}


	public String getConf() {
		return conf;
	}


	public void setConf(String conf) {
		this.conf = conf;
	}
	
}
